package com.tourism.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tourism.entity.TourRoute;
import com.tourism.entity.UserRoute;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserRouteMapper extends BaseMapper<UserRoute> {
    // 可以添加自定义的查询方法
    @Select("SELECT ur.*, tr.* FROM user_route ur " +
            "LEFT JOIN tour_route tr ON ur.route_id = tr.id " +
            "WHERE ur.user_id = #{userId}")
    TourRoute getUserSelectedRoute(@Param("userId") Integer userId);
}